package com.nulldev.util.security.encryptAPI_rw.impls.rabbit;

import java.io.InputStream;
import java.io.OutputStream;

import com.nulldev.util.data.Variables;
import com.nulldev.util.security.encryptAPI_rw.api.ICipherType;
import com.nulldev.util.security.encryptAPI_rw.api.IStandardBlockingCipher;
import com.nulldev.util.security.encryptAPI_rw.api.IStandardStreamingCipher;

public class RabbitCipher implements IStandardBlockingCipher, IStandardStreamingCipher {

	private static final String[] CIPHER_NAMES =
		{ "Rabbit", "RABBIT" };

	@Override
	public String getEncryptorID() {
		return "ecr_v3.internal.rabbit";
	}

	@Override
	public String[] getCipherNames() {
		return CIPHER_NAMES;
	}

	@Override
	public long encrypt(final InputStream is, final OutputStream os, final byte[] privateKey) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public long decrypt(final InputStream is, final OutputStream os, final byte[] privateKey) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public byte[] encrypt(final byte[] data, final byte[] key) {
		final InternalRabbitCipher ir = new InternalRabbitCipher();
		ir.setupKey(Variables.requireNonNullObject(key, "key"));
		ir.crypt(Variables.requireNonNullObject(data, "data"));
		return data;
	}

	@Override
	public byte[] decrypt(byte[] data, byte[] key) {
		final InternalRabbitCipher ir = new InternalRabbitCipher();
		ir.setupKey(Variables.requireNonNullObject(key, "key"));
		ir.crypt(Variables.requireNonNullObject(data, "data"));
		return data;
	}

	@Override
	public ICipherType getCipherType() {
		return ICipherType.PRIVATE_KEY;
	}

}
